//Accepted
#include <vector>
#include <set>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <map>
#include <iostream>
#include <list>
#include <deque>
#include <cstdio>
#include <cstring>
#include <cstdlib>
using namespace std;

int main (){
	//freopen("in.txt", "r", stdin);//freopen("out.txt", "w", stdout);
	int a, b, c, d, e, f;
	scanf("%d%d%d%d%d%d", &a, &b, &c, &d, &e, &f);
	if(a==d||b==e||c==f)printf("YES");
	else printf("NO");
	
	return 0;
}
